package cn.tedu._01mvcbooto1.controller;

import cn.tedu._01mvcbooto1.pojo.dto.BmiDTO;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

@Controller
public class BMIController {
    @RequestMapping("/bmi")
    @ResponseBody
    public String bmi(BmiDTO bmiDTO) {
        double height = bmiDTO.getHeight();
        double weight = bmiDTO.getWeight();
        double bmi = weight / (height * height);
        if (bmi < 18.5) {
            return "过轻";
        } else if (bmi < 25) {
            return "正常";
        } else if (bmi < 28) {
            return "过重";
        } else if (bmi < 32) {
            return "肥胖";
        } else {
            return " severely obese";
        }
    }
}
